<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

    </style>
</head>

<body>
    <img src="../css2/ldh.jpg" alt="">
    <input type="text" placeholder="请输入1~100之间的整数">
    <input type="button" value="猜一猜" onclick="f()">
    <div></div>
    <script>
        let x = parseInt(Math.random() * 100) + 1;
        let t = document.querySelector("input")
        let d = document.querySelector("div")
        let a = 0;
        function f() {
            a = a + 1;
            if (t.value < x) {
                d.innerHTML = "猜小了,猜了";
            } else if (t.value > x) {
                d.innerHTML = "猜大了,猜了";
            } else {
                d.innerHTML = "恭喜你猜对了,猜了";
            }
        }
        t.value="";
        console.log(x);


    </script>






</body>

</html>